package org.stone.project.logInterface.pojo.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import org.stone.project.common.utils.RequestIdUtil;

import java.util.Date;

/**
 * 系统日志
 */
@Getter
@Setter
public class SysLog{
    public SysLog() {
        this.recordDate = recordDate;
    }

    public SysLog(String level, String body) {
        requestId = RequestIdUtil.getRequestId();
        recordDate = new Date();
        this.level = level;
        this.body = body;
    }

    public SysLog(Date recordDate) {
        this.recordDate = recordDate;
    }

    /**
     * 请求id
     */
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private String requestId;

    /**
     * 记录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Date recordDate;

    /**
     * 等级
     */
    private String level;

    /**
     * 日志内容
     */
    private String body;
}
